package net.cnki.sunny.base;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

@Data
@Component("kbaseDs")
@ConfigurationProperties(prefix = "spring.datasource.kbase")
public class DataSourceKbaseManager {

    private String driverClassName;
    private String jdbcUrl;
    private String username;
    private String password;

    public Connection getConnection() throws ClassNotFoundException, SQLException {
        Class.forName(driverClassName);
        return   DriverManager.getConnection(jdbcUrl,username,password);
    }
}
